<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue-2.6.12开发.js"></script>
</head>

<body>
    <div id="root">
        <h1>今天天气很{{info}}</h1>
        <!-- 绑定事件= 可以写一些简单的js语句  但不推荐-->
        <!-- <button @click="isHoat =!isHoat">点我</button> -->
        <button @click="change">点我</button>
    </div>
    <script>
        const vm = new Vue({
            el: '#root',
            data: {
                isHoat: true
            },
            computed: {
                info() {
                    return this.isHoat ? '炎热' : '凉爽'
                }
            },
            // methods用于装普通函数的盒子 事件的回调需要配置在methods对象中,最终会在vm上 切记
            methods: {
                change() {
                    this.isHoat = !this.isHoat
                }

            }

        })
    </script>
</body>

</html>